package com.zealfi.wk.rabbitmq.core;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 * Created by kuan at 2018-05-10 下午 3:46
 */
@Component
public class Sender {

    @Autowired
    private AmqpTemplate rabbitTemplate;

    public void send() {
        String context = "hello " + LocalDateTime.now();
        System.out.println("Sender: " + context);
        rabbitTemplate.convertAndSend("hello", context);
    }
}
